package com.tarena.spring.auto;

import com.tarena.spring.user.UserTedu;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class UserTeduAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean(UserTedu.class)
    @ConditionalOnProperty(
            prefix = "user",
            value = "tedu.enable",
            havingValue = "true",
            matchIfMissing = true)
    public UserTedu userTedu(){
        return new UserTedu();
    }
}
